﻿using System.Security.Cryptography.X509Certificates;
using System.ServiceModel;
using Microsoft.Commerce.Proxy.AccountService;
using System;

namespace TestWebApplication.CommerceAccount.APIs
{
    public class CommerceAccountTestConnectionAPi : CommerceAccountApi
    {
        private string input;

        public CommerceAccountTestConnectionAPi(BasicHttpBinding binding, EndpointAddress address, X509Certificate2 clientCert, string input)
            : base(binding, address, clientCert)
        {
            this.input = input;
        }

        public string Output { get; private set; }

        protected override AbstractResponse ExecuteInternal(AccountServiceChannel channel)
        {
            
                Console.WriteLine(channel.LocalAddress + "kkk");
                this.Output = channel.TestConnection(this.input);
                Console.WriteLine(this.Output);

                return new AbstractResponse()
                {
                    Ack = AckCodeType.Success
                };
            
        }

        public override void PrepareRequestData()
        {
        }

        public override void PrepareResponseData()
        {
        }
    }
}
